/**
 * <p>Provides an implementation of the Atom Date Construct, 
 * which is itself a specialization of the RFC3339 date-time.</p>
 * 
 * <p>Accessors on this class are not synchronized.</p>
 * 
 * <p>Per RFC4287:</p>
 * 
 * <pre>
 *  3.3.  Date Constructs
 *
 *  A Date construct is an element whose content MUST conform to the
 *  "date-time" production in [RFC3339].  In addition, an uppercase "T"
 *  character MUST be used to separate date and time, and an uppercase
 *  "Z" character MUST be present in the absence of a numeric time zone
 *  offset.
 *
 *  atomDateConstruct =
 *     atomCommonAttributes,
 *     xsd:dateTime
 *
 *  Such date values happen to be compatible with the following
 *  specifications: [ISO.8601.1988], [W3C.NOTE-datetime-19980827], and
 *  [W3C.REC-xmlschema-2-20041028].
 *
 *  Example Date constructs:
 *
 *  &lt;updated>2003-12-13T18:30:02Z&lt;/updated>
 *  &lt;updated>2003-12-13T18:30:02.25Z&lt;/updated>
 *  &lt;updated>2003-12-13T18:30:02+01:00&lt;/updated>
 *  &lt;updated>2003-12-13T18:30:02.25+01:00&lt;/updated>
 *
 *  Date values SHOULD be as accurate as possible.  For example, it would
 *  be generally inappropriate for a publishing system to apply the same
 *  timestamp to several entries that were published during the course of
 *  a single day.
 *  </pre>
 *  
 */	
public class AtomDate {

	private Datetime theDateTime;

	public AtomDateTime(Datetime dt) {
		theDateTime = dt;
	}
	
	public AtomDateTime(String atomDateString) {
		this(dateTime.valueOf(atomDateString.replace('T', ' ')));
	}
	public String getApexString() {
		return theDateTime.format('yyyy-MM-dd mm:hh:ss z');
	}
	
	public String getAtomString() {
		return theDateTime.format('yyyy-MM-dd mm:hh:ssz').replace(' ', 'T');
	}
	
	public DateTime getDateTime() {
		return theDateTime;
	}			
}	
